layui.use(['laydate','form','layer'],function(){
    var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery;
    var laydate = layui.laydate;
    laydate.render({
        elem: '#startTime', //指定元素
        type: 'datetime'
    });
    laydate.render({
        elem: '#endTime', //指定元素
        type: 'datetime'
    });

    form.on("submit(btnSubmit)",function(data){
        //弹出loading
        var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});

        var field = data.field;
        // 实际使用时的提交信息
        $.post("/activity/updateOrAddEntity",{
            id : $("#id").val(),
            title : $("#title").val(),
            brandId : $("#brandId").val(),
            keywordOne : $("#keywordOne").val(),
            keywordTwo : $("#keywordTwo").val(),
            keywordThree : $("#keywordThree").val(),
            keywordThree : $("#keywordThree").val(),
            description : $("#description").val(),
            startTime : $("#startTime").val(),
            endTime : $("#endTime").val(),
            showPic : $("#showPic").val(),
            orderNum : $("#orderNum").val()
        },function(result){
            if(1==result.returnInfo.state){
                top.layer.close(index);
                top.layer.msg("操作成功！");
                layer.closeAll("iframe");
                //刷新父页面
                parent.location.reload();
            }else{
                top.layer.msg(result.returnInfo.errorMsg);
            }
        },"json")
        return false;
    });
})